//
//  WCNSettimePartView.m
//  WCN
//
//  Created by wsj2015 on 15/12/30.
//  Copyright © 2015年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WCNSettimePartView.h"

@implementation WCNSettimePartView
{
    UIButton *_lastBtn;

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (void)awakeFromNib
{
   
    [self.inBtn setImage:[UIImage imageNamed:@"Mult_Select"] forState:UIControlStateSelected];
    [self.inBtn setImage:[UIImage imageNamed:@"Selected_no"] forState:UIControlStateNormal];
    [self.outBtn setImage:[UIImage imageNamed:@"Mult_Select"] forState:UIControlStateSelected];
    [self.outBtn setImage:[UIImage imageNamed:@"Selected_no"] forState:UIControlStateNormal];
    self.inBtn.selected = YES;
    _lastBtn = self.inBtn;
    

}
- (IBAction)inAction:(UIButton *)sender {
    if (sender ==_lastBtn) {
        return;
    }
    
    if (self.changeBlock) {
        self.changeBlock(1);
    }
    _lastBtn.selected = !_lastBtn.selected;
    sender.selected = !sender.selected;
    _lastBtn =sender;
    
}
- (IBAction)outAction:(UIButton *)sender {
    if (sender ==_lastBtn) {
        return;
    }
    if (self.changeBlock) {
        self.changeBlock(0);
    }
    _lastBtn.selected = !_lastBtn.selected;
    sender.selected = !sender.selected;
    _lastBtn =sender;
    
}

+ (instancetype)viewFromeXib{
    return [[NSBundle mainBundle] loadNibNamed:@"WCNSettimePartView" owner:nil options:0].firstObject;
}

@end
